home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 21
/
CU Amiga Magazine's Super CD-ROM 21 (1998)(EMAP Images)(GB)[!][issue 1998-04].iso
/
CUCD
/
Magazine
/
C_Tutorial
/
Part-9
/
wb1
/
drawwin.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-10-27
|
2KB
|
63 lines
#include "drawwin.h"
#include "bitmap.h"
#include "gadgets.h"
#include "menu.h"
#include "screen.h"
#include<graphics/rastport.h>
#include<stdio.h>
#include<clib/graphics_protos.h>
#include<clib/intuition_protos.h>
/* Global record of our tool window */
struct Window* drawwin = NULL;
int openDrawWin()
{
struct Screen* scr = getScreen();
/* Open our drawing window */
if(drawwin = OpenWindowTags(NULL,
WA_Left, 0,
WA_Top, 0,
/* Make the window the same size as the screen */
WA_Width, scr->Width,
WA_Height, scr->Height,
WA_Flags, WFLG_BACKDROP | WFLG_BORDERLESS | WFLG_REPORTMOUSE | WFLG_SUPER_BITMAP,
WA_IDCMP, IDCMP_MOUSEBUTTONS | IDCMP_MOUSEMOVE | IDCMP_MENUPICK,
WA_CustomScreen, scr,
WA_SuperBitMap, getBitmap(),
TAG_DONE, 0))
{
/* Clear our window, since our new bitmap may not be cleared already */
SetRast(drawwin->RPort, 0);
/* Set the drawing mode to draw only the foreground of text, not the background */
SetDrMd(drawwin->RPort, JAM1);
resetFgPen(drawwin);
/* Attach menu strip to drawing window */
if(SetMenuStrip(drawwin, getMenuStrip()))
return TRUE;
else
printf("Error: could not attach menus to drawing window\n");
}
else
printf("Error: could not open drawing window\n");
return FALSE;
}
void closeDrawWin()
{
if(drawwin)
{
ClearMenuStrip(drawwin);
CloseWindow(drawwin);
drawwin = NULL;
}
}
struct Window* getDrawWin()
{
return drawwin;
}